<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<DateTime?>" %>

<%= Html.TextBox(String.Empty, Model.HasValue ? Model.Value.ToString("dd/MM/yyyy") : string.Empty, new { @class = "datePicker" })%>
<script type="text/javascript">
    $(document).ready(function() {
    $('input').filter('.datePicker').datepicker(
        { 
        changeYear: true,
        yearRange: '-20:00',
        showOn: 'button',
        buttonImage: '<%= Url.Content("~/Content/Images/calendar.gif")%>',
        buttonImageOnly: true,
        dateFormat: 'dd/mm/yy'
        });
    });
</script>
